<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:73:"D:\phpStudy\WWW\ysyshop\public/../application/admin\view\order\index.html";i:1522641880;s:63:"D:\phpStudy\WWW\ysyshop\application\admin\view\public\base.html";i:1522810551;}*/ ?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>优视雅 后台管理</title>
  <link rel="stylesheet" href="/static/layui/css/layui.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">

    

    

  <div class="layui-header">
    <div class="layui-logo">优视雅 后台管理</div>

    <!-- 头部区域（可配合layui已有的水平导航） -->
    <!-- <ul class="layui-nav layui-layout-left">
      <li class="layui-nav-item"><a href="">控制台</a></li>
      <li class="layui-nav-item"><a href="">商品管理</a></li>
      <li class="layui-nav-item"><a href="">用户</a></li>
      <li class="layui-nav-item">
        <a href="javascript:;">其它系统</a>
        <dl class="layui-nav-child">
          <dd><a href="">邮件管理</a></dd>
          <dd><a href="">消息管理</a></dd>
          <dd><a href="">授权管理</a></dd>
        </dl>
      </li>
    </ul> -->
    <ul class="layui-nav layui-layout-right">
      <li class="layui-nav-item">
        <a href="javascript:;">
          <!-- <img src="http://t.cn/RCzsdCq" class="layui-nav-img"> -->
          <?php echo $userName; ?>
        </a>

          <dl class="layui-nav-child">
              <dd><a onclick="savePasswd()">修改密码</a></dd>
          </dl>

      </li>
      <li class="layui-nav-item"><a href="<?php echo url("Admin/quitLogin"); ?>">退了</a></li>
    </ul>
  </div>
  
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
      <ul class="layui-nav layui-nav-tree"  lay-filter="test">
        <li class="layui-nav-item"><a href='<?php echo url("Index/index"); ?>'>首页</a></li>
        <?php foreach($navList as $v): ?>
          <li class='layui-nav-item <?php if( in_array( $navArr["nav_controller"], $v["controllers"]) ){ echo "layui-nav-itemed"; } ?>'>
            <a class="javascript:;" href="javascript:;"><?php echo $v['name']; ?> <span class="layui-nav-more"></span></a>
            <dl class="layui-nav-child">
                <?php foreach($v['list'] as $vv): ?>
                <dd class='<?php if( $vv["nav_controller"] == $navArr["nav_controller"] && $vv["nav_action"] == $navArr["nav_action"]){  echo "layui-this"; } ?>'>
                    <a href='<?php echo url($vv['url']); ?>'><?php echo $vv['name']; ?></a>
                </dd>
                <?php endforeach; ?>
            </dl>
        </li>
        <?php endforeach; ?>
      </ul>
    </div>
  </div>
  

  <div class="layui-body">
    <!-- 内容主体区域 -->
    
      <div style="padding: 15px 20px;">
            <div class="content">
                <div class="content-top">
                    <p><?php echo $headerName; ?></p>
                </div>
                <div style="padding: 10px;">
                    

<div class="account-info">
    <div class="screening">
        <form class="layui-form" action="" method="get">

            <div class="layui-form-item" style="clear: none;float: left">
                <label class="layui-form-label">订单编号</label>
                <div class="layui-input-inline">
                    <input type="text" name="order_sn"  lay-verify="sort" autocomplete="off" class="layui-input" value="<?php echo !empty($Arr['order_sn'])?$Arr['order_sn'] : ''; ?>">
                </div>
            </div>
            <div class="layui-form-item" style="clear: none;float: left">
                <label class="layui-form-label">订单状态</label>
                <div class="layui-input-inline">
                    <select name="status">
                        <option value="0"  <?php echo $Arr['status']==0?'selected' : ''; ?> >请选择</option>
                        <option value="1"  <?php echo $Arr['status']==1?'selected' : ''; ?> >已提交</option>
                        <option value="2" <?php echo $Arr['status']==2?'selected' : ''; ?> >已支付</option>
                        <option value="2" <?php echo $Arr['status']==5?'selected' : ''; ?> >线下付款</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item" style="clear: none;float: left">
                <label class="layui-form-label">开始时间</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" lay-verify="start_time" value="<?php echo !empty($Arr['start_time'])?$Arr['start_time'] : ''; ?>" name="start_time" id="start_time" placeholder="yyyy-MM-dd HH:mm:ss">
                </div>
            </div>
            <div class="layui-form-item" style="clear: none;float: left">
                <label class="layui-form-label">结束时间</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" name="end_time" value="<?php echo !empty($Arr['end_time'])?$Arr['end_time'] : ''; ?>" id="end_time" placeholder="yyyy-MM-dd HH:mm:ss">
                </div>
            </div>

            <div class="layui-form-item" style="clear: none;float: left">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">确定</button>
                </div>
            </div>
            <div style="clear: both"></div>
        </form>
    </div>
    <div class="info">
        <table id="demo" class="layui-table" lay-data="{height:730, url:'<?php echo $url; ?>', page:true, id:'test'}" lay-filter="test">
            <thead>
            <tr>
                <th lay-data="{field:'id', width:60, sort: true}">ID</th>
                <th lay-data="{field:'order_sn', width:180}">订单编号</th>
                <th lay-data="{field:'user_id', width:100}">购买人ID</th>
                <th lay-data="{field:'goods_name', width:160}">商品名</th>
                <th lay-data="{field:'goods_price', width:80}">价格</th>
                <th lay-data="{field:'num', width:60}">数量</th>
                <th lay-data="{field:'amount', width:90}">支付总额</th>
                <th lay-data="{field:'add_time', width:150, sort: true}">购买时间</th>
                <th lay-data="{field:'statusName', width:150, sort: true}">状态</th>
                <th lay-data="{field:'statusVal', width:200,toolbar: '#barDemo'}">操作</th>
            </tr>
            </thead>
        </table>
    </div>
</div>


                </div>
            </div>
        </div>
    
  </div>
  
  <div class="layui-footer">
    <!-- 底部固定区域 -->
    © www.yosiya.net - 优视雅集团有限公司
  </div>
</div>

<script src="/static/common/js/jquery-3.2.1.min.js" charset="utf-8"></script>
<script src="/static/layer/layer.js" charset="utf-8"></script>
<script src="/static/layui/layui.js"  charset="utf-8"></script>
<script src="/static/admin/js/common.js" charset="utf-8"></script>
<script>
    window.global = {
        pageType: 'demo'
        ,preview: function(){
            var preview = document.getElementById('LAY_preview');
            return preview ? preview.innerHTML : '';
        }()
    };
    var web_width = window.innerWidth;
    if( web_width <= 1200 ){
        layui.config({
            base: '/static/layui/'
        }).use('global');
    }

    function savePasswd(){
        layui.use('layer', function(){
            var layer = layui.layer;

            layer.open({
                title:"修改密码",
                type: 2,
                area: ['500px', '400px'],
                content: ['<?php echo url("Admin/savePasswd"); ?>', 'no'],
                end: function () {
                    location.reload();
                }
            });
        });
    }
</script>

<div id="LAY_democodejs">
    <script>
        layui.use('element', function(){
            var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块

            //监听导航点击
            element.on('nav(demo)', function(elem){
                //console.log(elem)
                layer.msg(elem.text());
            });
        });
    </script>
</div>



<script type="text/javascript">

    layui.use('table', function(){
        var table = layui.table;
        //监听工具条
        table.on('tool(test)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
            var data = obj.data; //获得当前行数据
            var layEvent = obj.event; //获得 lay-event 对应的值
            var tr = obj.tr; //获得当前行 tr 的DOM对象

            if(layEvent === 'detail'){ //查看
                var id = data.id;
                layui.use('layer', function(){
                    var layer = layui.layer;
                    layer.open({
                        title:"订单详情",
                        type: 2,
                        area: ['800px', '800px'],
                        content: ['/admin/order/details?id='+id, 'no'],
                        end: function () {
                            location.reload();
                        }
                    });
                });
            }else if(layEvent === 'del'){ //失败
                var status = data.statusVal;
                if( status == 5 || status == 15 ){
                    prompt_From_one("此订单不能删除");
                    return false;
                }
                layer.confirm('确定为删除吗？不可更改！', function(index){

                    var id = data.id;
                    $.ajax({
                        type: 'POST',
                        url: '<?php echo url("Order/order_del"); ?>',
                        dataType: 'json',
                        data: {id: id,status:5},
                        success: function (data) {
                            layer.close(index);
                            if( data.result != 0 ){
                                prompt_From_one(data.msg);
                            }else{
                                location.reload();
                            }
                        }
                    });
                    //向服务端发送删除指令
                });

            }else if( layEvent === 'delivery' ){
                var status1 = data.statusVal;
                if( status1 == 15 || status1 == 5 ){
                    prompt_From_one("此订单不能驳回");
                    return false;
                }
                layer.confirm('确定此订单驳回吗？不可更改！', function(index){

                    var id = data.id;
                    $.ajax({
                        type: 'POST',
                        url: '<?php echo url("Order/order_del"); ?>',
                        dataType: 'json',
                        data: {id: id,status:5},
                        success: function (data) {
                            layer.close(index);
                            if( data.result != 0 ){
                                prompt_From_one(data.msg);
                            }else{
                                location.reload();
                            }
                        }
                    });
                    //向服务端发送删除指令
                });
            }

        });


    });

    layui.use('form', function(){
        var form = layui.form;
        form.verify({
            start_time: function(value){
                var  end_time = $("#end_time").val();
                if( end_time != ""){
                    if( value == "" ){
                        return '请选择开始时间';
                    }
                }
            }
        });
    });

    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //时间选择器
        laydate.render({
            elem: '#start_time'
            ,type: 'datetime'
            ,trigger: 'click'
        });
        laydate.render({
            elem: '#end_time'
            ,type: 'datetime'
            ,trigger: 'click'
        });
    });
</script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-mini" lay-event="detail">查看</a>
    <a class="layui-btn layui-btn-normal layui-btn-mini" lay-event="delivery">驳回</a>
    <!--<a class="layui-btn layui-btn-danger layui-btn-mini" lay-event="del">删除</a>-->
</script>


</body>
</html>